import { Directive } from 'vue'

export const vPermission: Directive = {
  mounted(el: HTMLElement, binding) {
    const { value } = binding
    const permissions = ['admin', 'editor'] // 从store或API获取实际权限
    
    if (value && !permissions.includes(value)) {
      el.parentNode?.removeChild(el)
    }
  }
}

// 使用方式: <button v-permission="'admin'">Admin Only</button>